package com.itheima.mapper;

import com.itheima.bean.Person;
import com.itheima.bean.Stucord;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


public interface OnetoOneZj {
    @Select("SELECT * FROM stucord")
    @Results({
            @Result(column = "id" ,property = "id"),
            @Result(column = "cord" ,property = "cord"),//column字段名,property属性名
            @Result(
                    property = "person",
                    javaType = Person.class,
                    column = "id",//根据查询出来的pid作为参数传递到Person做条件
                    one = @One(select = "com.itheima.mapper.PersonIf.selectAlltwo")
            )
    })
    public ArrayList<Stucord> selectAll() throws IOException;
}
